﻿//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	RuleCtx.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

using System;
using System.Collections.Generic;

namespace Smart.Common.Rules
{
	/// <summary>
	/// Rules context
	/// </summary>
	public class RulesCtx
	{
		/// <summary>
		/// Rules service type name
		/// </summary>
		public string ServiceName { get; set; }

		/// <summary>
		/// Current service
		/// </summary>
		public IRulesService Service { get; set; }

		/// <summary>
		/// Instance Id
		/// </summary>
		public string InstanceId { get; set; }

		/// <summary>
		/// Current instance
		/// </summary>
		public IRulesInstance Instance { get; set; }

		/// <summary>
		/// Current rules from instance
		/// </summary>
		public List<IRule> Rules { get; set; }

		/// <summary>
		/// Internal variables
		/// </summary>
		public Dictionary<string, object> Variables { get; set; }

		/// <summary>
		/// Flag to stop rules processing
		/// </summary>
		public bool StopRulesProcessing { get; set; }

		/// <summary>
		/// Rules context
		/// </summary>
		public RulesCtx(string rulesServiceName)
		{
			ServiceName = rulesServiceName;

			Rules = new List<IRule>();
			Variables = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
		}
	}
}